﻿﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <link rel="stylesheet" href="~/jquery-easyui-1.8.6/themes/bootstrap/easyui.css" />
    <link rel="stylesheet" href="~/jquery-easyui-1.8.6/themes/icon.css" />
    <link rel="stylesheet" href="~/easyui-icons/IconExtension.css" />
    <link rel="stylesheet" href="~/css/style.css" />
    <style>
        html, body {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }

        body {
            display: flex;
            align-items: center; /*定义body的元素垂直居中*/
            justify-content: center; /*定义body的里的元素水平居中*/
        }
    </style>
    <script type="text/javascript" src="~/jquery-easyui-1.8.6/jquery.min.js" asp-append-version="false"></script>
    <script type="text/javascript" src="~/jquery-easyui-1.8.6/jquery.easyui.min.js" asp-append-version="false"></script>
    <script type="text/javascript" src="~/jquery-easyui-1.8.6/jquery-easyui-datagridview/datagrid-groupview.js" asp-append-version="false"></script>
    <script type="text/javascript" src="~/jquery-easyui-1.8.6/jquery-easyui-datagridview/datagrid-defaultview.js" asp-append-version="false"></script>
    <script type="text/javascript" src="~/jquery-easyui-1.8.6/jquery-easyui-datagridview/datagrid-scrollview.js" asp-append-version="false"></script>
    <script type="text/javascript" src="~/jquery-easyui-1.8.6/jquery-easyui-datagridview/datagrid-export.js" asp-append-version="false"></script>
    <script type="text/javascript" src="~/jquery-easyui-1.8.6/locale/easyui-lang-zh_CN.js" asp-append-version="false"></script>
    <title>login</title>
</head>
<body>
    <div class="easyui-panel" title="" style="width:100%;max-width:400px;padding:30px 60px;text-align:center;">
        <form id="ff">
            <div>
                <label for="loginname">登录名：</label><!--data-options="required:true"-->
                <input id="loginname" class="easyui-textbox" type="text" name="loginname" />
            </div>
            <br />
            <div>
                <label for="password">密&nbsp;&nbsp;&nbsp;码：</label><!--data-options="required:true"-->
                <input id="password" class="easyui-textbox" type="password" name="password" />
            </div>
            <div style="text-align:center;padding:5px 0">
                <a id="btnGoLogin" class="easyui-linkbutton">登录</a>
            </div>
        </form>
    </div>
    <script type="text/javascript">
        $(function () {
            $("#f").form('submit',{
                url: "jwttoken3.0",
                success: function (data) {
                    alert("form")
                    alert(data);
                    //data = JSON.parse(data);
                    if (data.ReturnStatus != undefined && data.ReturnStatus == 1) {
                        //localStorage.setItem('token', data.Result.token);
                        window.location.href = "home/index";
                    }
                    else {
                        alert(data.Message);
                    }
                }

            });
            $("#btnGoLogin").bind('click', function () {
                //$("#ff").form('submit');
                //return;
                var loginname = $("#loginname").textbox("getValue"),
                    pwd = $("#password").textbox("getValue");
                $.ajax({
                    url: "./jwttoken3.0",
                    type: "POST",
                    dataType: "json",
                    data: { loginName: loginname, password: pwd },
                    success: function (data) {
                        //alert(data);
                        //data = JSON.parse(data);
                        if (data.ReturnStatus != undefined && data.ReturnStatus == 1) {
                            localStorage.setItem('token', data.Result.token);
                            window.location.href = "home/index";
                        }
                        else {
                            alert(data.Message);
                        }
                    }
                    , error: function (XMLHttpRequest) {
                        if (XMLHttpRequest.responseJSON != undefined) {
                            alert(XMLHttpRequest.responseJSON.Message);
                        }
                        else {
                            console.log(XMLHttpRequest);
                            alert("出现位置错误");
                        }
                    }
                });
            });

        });
    </script>
</body>
</html>
